﻿using MediatR;
using T_settlement.API.Application.Command.OutputCommand;
using T_settlement.Infrastructure.Interfacec;

namespace T_settlement.API.Application.CommandHandlers.OutputCommandHandlers
{
    public class DelOutputCommandHandlers:IRequestHandler<DelOutputCommand,int>
    {
        private readonly IOutputRepository outputRepository;

        public DelOutputCommandHandlers(IOutputRepository outputRepository)
        {
            this.outputRepository = outputRepository;
        }

        public async Task<int> Handle(DelOutputCommand request, CancellationToken cancellationToken)
        {
            var list = await outputRepository.GetModelAsync(request.OutputId);
            list.IsDel = true;
            var res =await outputRepository.UpdateAsync(list);
            return res;
                
        }
    }
}
